#include <matrix.hpp>

#include <iostream>
#include <algorithm>

#include <random.hpp>


#include <boost/lambda/lambda.hpp>

using namespace boost::lambda;

using namespace std;
using namespace sm;


int main()
{
	dynamic_matrix<int> dm1( 10, 10 );

	feng::variate_generator<int> vg( 0, 1000, 0 );
	
	int tmp = 0;

	for_each( dm1.begin(), dm1.end(), _1 = var(tmp)++ ); 


	//copy( vg.begin(), vg.begin()+dm1.size(), dm1.begin() );

	cout << "dm1:\n" << dm1 << "\n";
	
	dynamic_matrix<int> dm2( 10, 10 );
	
	//OK
	//copy( dm1.row_range_begin(0,3), dm1.row_range_begin(0,3)+1, dm2.row_range_begin(3,6) );
	
	//OK	
	//copy( dm1.row_range_begin(0,3), dm1.row_range_begin(0,3)+6, dm2.col_range_begin(3,6) );
	
	//OK	
	//copy( dm1.col_range_begin(0,3), dm1.col_range_begin(0,3)+1, dm2.col_range_begin(4,7) );
	
	//OK
	//copy( dm1.col_range_begin(0,3), dm1.col_range_begin(0,3)+7, dm2.row_range_begin(4,7) );
	
	//Failed
	//copy( dm1.row_range_rbegin(0,3), dm1.row_range_rbegin(0,3)+1, dm2.row_range_rbegin(3,6) );
	
	//Failed	
	//copy( dm1.row_range_rbegin(0,3), dm1.row_range_rbegin(0,3)+6, dm2.col_range_rbegin(3,6) );
	
	//Failed	
	copy( dm1.col_range_rbegin(0,3), dm1.col_range_rbegin(0,3)+9, dm2.col_range_rbegin(4,7) );
	
	//Failed
	//copy( dm1.col_range_rbegin(0,3), dm1.col_range_rbegin(0,3)+7, dm2.row_range_rbegin(4,7) );

	cout << "dm2:\n" << dm2 << "\n";


	return 0;
}






